local scene = director:createScene()

function scene:setUp(event)
    dbg.print("sceneScore:setUp")
	
	local newScale = 320/director.displayWidth
	local newScaleY = 480/director.displayHeight
	
	file = io.open("scorejump.txt")
	scoreListJumpOne = file:read()
	scoreListJumpTwo = file:read()
	scoreListJumpThree = file:read()
	file:close()
	
	file = io.open("scoreevade.txt")
	scoreListEvadeOne = file:read()
	scoreListEvadeTwo = file:read()
	scoreListEvadeThree = file:read()
	file:close()
	
	local box = director:createRectangle( {x=50/newScale, y=50/newScaleY, w=220/newScale, h=380/newScaleY, color=color.green} )
	local labelScoreOne = director:createLabel({x=160/newScale, y=380/newScaleY, text="BEST TIMES", hAlignment="center", xAnchor=0.5, color=color.red, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreTwo = director:createLabel({x=160/newScale, y=320/newScaleY, text="Jump", hAlignment="center", xAnchor=0.5, color=color.blue, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreThree = director:createLabel({x=160/newScale, y=290/newScaleY, text=scoreListJumpOne,hAlignment="center", xAnchor=0.5, color=color.black, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreFour = director:createLabel({x=160/newScale, y=260/newScaleY, text=scoreListJumpTwo,hAlignment="center", xAnchor=0.5, color=color.black, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreFive = director:createLabel({x=160/newScale, y=230/newScaleY, text=scoreListJumpThree,hAlignment="center", xAnchor=0.5, color=color.black, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreSix = director:createLabel({x=160/newScale, y=170/newScaleY, text="Evade", hAlignment="center", xAnchor=0.5, color=color.blue, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreSeven = director:createLabel({x=160/newScale, y=140/newScaleY, text=scoreListEvadeOne,hAlignment="center", xAnchor=0.5, color=color.black, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreEight = director:createLabel({x=160/newScale, y=110/newScaleY, text=scoreListEvadeTwo,hAlignment="center", xAnchor=0.5, color=color.black, xScale=1/newScale, yScale=1/newScaleY,})
	local labelScoreNine = director:createLabel({x=160/newScale, y=80/newScaleY, text=scoreListEvadeThree,hAlignment="center", xAnchor=0.5, color=color.black, xScale=1/newScale, yScale=1/newScaleY,})
	
	local buttonBack = director:createSprite(250/newScale, 50/newScaleY, "img/buttonBack.png")
	buttonBack.xAnchor=0.5; buttonBack.yAnchor=0.5
	buttonBack.xScale=.5/newScale; buttonBack.yScale=.5/newScaleY; 
	buttonBack.y = buttonBack.y - buttonBack.h/2
	
	function buttonBack:touch(event)
		if (event.phase == 'began') then
			system:sendEvent("moveToSceneMenu")
		end
	end
	buttonBack:addEventListener('touch', buttonBack)
end

function scene:tearDown(event)
    dbg.print("sceneScore:tearDown")
end

scene:addEventListener({"setUp", "tearDown"}, scene)

return scene -- We must return the scene object!